// $Id: oaxaca.h 68 2012-07-20 04:15:12Z alan.watson.f $

#if __cplusplus
extern "C" {
#endif

#include <stdio.h>

#include <sys/types.h>

typedef struct {
  double yc0, xc0;
  size_t ms, mc;
} oaxaca_spot_t;

typedef struct oaxaca_shm {
  struct {
    int initialized;
    int command;
    int modal;
    unsigned long cycle;
    double v[OAXACA_WFC_NV];
    double mode[OAXACA_WFC_NMODE];
  } wfc;
  struct {
    int initialized;
    int command;
    unsigned long cycle;
    double pixelclockfrequency;
    struct {
      int sx, sy, nx, ny;
    } window;
    double minframefrequency, maxframefrequency;
    double framefrequency;
    double exposuretime;
    int nspot;
    oaxaca_spot_t spot[OAXACA_WFS_NSPOT_MAX];
    double aogain;
  } wfs;
} oaxaca_shm_t;

extern oaxaca_shm_t * oaxaca_shm;
extern const char *oaxaca_shm_initialize(void);

extern FILE *oaxaca_stderr;
extern void oaxaca_error(const char *, ...);
extern void oaxaca_info(const char *, ...);
extern void oaxaca_common_main(const char *);
extern int *oaxaca_initialized;
extern void oaxaca_exit(int);

extern void oaxaca_usleep(long);

extern const char *oaxaca_initialize(void);

extern void oaxaca_wfc_main(void);

extern int oaxaca_wfc_initialized(void);
extern char oaxaca_wfc_command(void);
extern void oaxaca_wfc_set_command(char);
extern int oaxaca_wfc_modal(void);
extern void oaxaca_wfc_set_modal(int);
extern unsigned long oaxaca_wfc_cycle(void);
extern double oaxaca_wfc_voltage(unsigned int);
extern void oaxaca_wfc_set_voltage(unsigned int, unsigned char);
extern double oaxaca_wfc_mode(unsigned int);
extern void oaxaca_wfc_set_mode(unsigned int, double);

extern void oaxaca_wfs_main(void);

extern int oaxaca_wfs_initialized(void);
extern char oaxaca_wfs_command(void);
extern void oaxaca_wfs_set_command(char);
extern unsigned long oaxaca_wfs_cycle(void);
extern double oaxaca_wfs_pixelclockfrequency(void);
extern void oaxaca_wfs_set_pixelclockfrequency(double);
extern int oaxaca_wfs_window_sx(void);
extern void oaxaca_wfs_set_window_sx(int);
extern int oaxaca_wfs_window_sy(void);
extern void oaxaca_wfs_set_window_sy(int);
extern int oaxaca_wfs_window_nx(void);
extern void oaxaca_wfs_set_window_nx(int);
extern int oaxaca_wfs_window_ny(void);
extern void oaxaca_wfs_set_window_ny(int);
extern double oaxaca_wfs_minframefrequency(void);
extern double oaxaca_wfs_maxframefrequency(void);
extern double oaxaca_wfs_framefrequency(void);
extern void oaxaca_wfs_set_framefrequency(double);
extern double oaxaca_wfs_exposuretime(void);
extern void oaxaca_wfs_set_exposuretime(double);
extern double oaxaca_wfs_aogain(void);
extern void oaxaca_wfs_set_aogain(double);

#if __cplusplus
}
#endif
